home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1043 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.9 KB  |  50 lines

  1. Newsgroups: comp.lang.c++,comp.lang.c
  2. Subject: Re: Need info on __far and __huge macros in Microsoft C please!
  3. From: ufo@sbbs.se (Urban Fosseus)
  4. X-Newsreader: WinVN 0.99.7
  5. References: <4cqcjr$k85@cloner3.netcom.com>
  6. MIME-Version: 1.0
  7. Content-Type: Text/Plain; charset=US-ASCII
  8. NNTP-Posting-Host: ppp11.sbbs.se
  9. Message-ID: <30f1c935.0@news.sbbs.se>
  10. Date: 9 Jan 96 01:47:33 GMT
  11. Path: news.sbbs.se!
  12.  
  13. In article <4cqcjr$k85@cloner3.netcom.com>, travisp@ix.netcom.com (Gerald 
  14. Phillips) says...
  15. >
  16. >I am attempting to convert some code from Microsoft C to TC++.  If
  17. >someone could give me some specs. on the "__far" and "__huge" macros
  18. >from MSC I would appreciate it.
  19. >
  20. >gtp
  21. >
  22.  
  23. NEAR , FAR and HUGE are macros that expand to __far and __huge when compiling
  24. for MSDOS or Win16
  25.  
  26. __near , __far and __huge are directives that tell the compiler what sort of 
  27. pointer it is. 
  28.  
  29. A __far pointer can point at any <= 64 kB block in any _one_ 16-bit segment. 
  30. This is the "classic" x86 pointer. 
  31. A __near pointer points into the default data segment, which _totals_ 
  32. <= 64 kB, but there is a lot of other stuff there to begin with, so it
  33. is of very limited use as dynamic heap for any "serious" program.
  34. A __huge pointer is a pointer into a consequtive sequence of 16-bit
  35. segments that act as one > 64 kB block, typically an array of < 64 kB structs
  36. or objects but with "too many" elements. There is quite a lot of code
  37. generated for each dereference of a __huge pointer.
  38.  
  39. A compiler-switch tells which type of pointer that is the default. For 
  40. hysterical resons many old Windows apps are compiled with the "Medium"
  41. memory model, i.e. using __near pointers as default, and then having
  42. explicit _far on practicly everything in the code.
  43.  
  44. If You are porting to Win32, just delete everything, and you will be fine.
  45. If you port to another Win16 or MS-DOS environment, find the equivalents
  46. for your new compiler, I'm sure they're there somewhere.
  47.  
  48. // Urban
  49.  
  50.